import { request } from '@umijs/max';
import { IRes, IResPage } from '.';

export interface IBusinessUserinfo {
  cellphone: string;
  gender: string;
  id: number;
  password: string;
  realName: string;
  remark: string;
  username: string;
}

export async function apiGetBusinessUserinfoPage(
  params: Partial<IBusinessUserinfo>,
) {
  return request<IResPage<IBusinessUserinfo>>('/v1/business/userinfo/page', {
    method: 'GET',
    params,
  });
}

export async function apiGetBusinessUserinfoSave(
  params: Partial<IBusinessUserinfo>,
) {
  return request<IRes<IBusinessUserinfo>>('/v1/business/userinfo/save', {
    method: 'POST',
    data: params,
  });
}

export async function apiGetBusinessUserinfoUpdate(
  params: Partial<IBusinessUserinfo>,
) {
  return request<IRes<IBusinessUserinfo>>('/v1/business/userinfo/update', {
    method: 'PUT',
    data: params,
  });
}

export async function apiGetBusinessUserinfoDelete(id: number) {
  return request<IRes<boolean>>(`/v1/business/userinfo/${id}`, {
    method: 'DELETE',
  });
}
